plugins {
    id 'com.android.application'
}

android {
    compileSdk 34
    flavorDimensions = ["mode", "api", "abi"]

    defaultConfig {
        applicationId "com.fongmi.android.tv"
        minSdk 21
        targetSdk 28
        versionCode 212
        versionName "2.1.2"
        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
            }
        }
    }

    productFlavors {
        leanback {
            dimension "mode"
        }
        mobile {
            dimension "mode"
        }
        java {
            dimension "api"
        }
        python {
            dimension "api"
        }
        armeabi_v7a {
            dimension "abi"
            ndk { abiFilters "armeabi-v7a" }
        }
        arm64_v8a {
            dimension "abi"
            ndk { abiFilters "arm64-v8a" }
        }
    }

    buildFeatures {
        viewBinding true
    }

    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    packagingOptions {
        exclude 'META-INF/beans.xml'
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }

    android.applicationVariants.configureEach { variant ->
        variant.outputs.configureEach { output ->
            outputFileName = "${variant.productFlavors[0].name}-${variant.productFlavors[1].name}-${variant.productFlavors[2].name}.apk"
        }
    }

    lint {
        disable 'UnsafeOptInUsageError'
    }
}

dependencies {
    implementation project(':hook')
    implementation project(':tvbus')
    implementation project(':catvod')
    implementation project(':danmaku')
    implementation project(':quickjs')
    implementation project(':thunder')
    implementation project(':jianpian')
    implementation project(':forcetech')
    implementation project(':ijkplayer')
    pythonImplementation project(':pyramid') 
    implementation platform('org.jetbrains.kotlin:kotlin-bom:1.8.20')
    implementation 'androidx.media3:media3-database:' + media3Version
    implementation 'androidx.media3:media3-datasource:' + media3Version
    implementation 'androidx.media3:media3-datasource-okhttp:' + media3Version
    implementation 'androidx.media3:media3-datasource-rtmp:' + media3Version
    implementation 'androidx.media3:media3-exoplayer:' + media3Version
    implementation 'androidx.media3:media3-exoplayer-dash:' + media3Version
    implementation 'androidx.media3:media3-exoplayer-hls:' + media3Version
    implementation 'androidx.media3:media3-exoplayer-rtsp:' + media3Version
    implementation 'androidx.media3:media3-exoplayer-smoothstreaming:' + media3Version
    implementation 'androidx.media3:media3-extractor:' + media3Version
    implementation 'androidx.media3:media3-session:' + media3Version
    implementation 'androidx.media3:media3-ui:1.1.1'
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'androidx.biometric:biometric:1.1.0'
    implementation 'androidx.lifecycle:lifecycle-viewmodel:2.6.2'
    implementation 'androidx.room:room-runtime:2.6.1'
    implementation 'androidx.media:media:1.6.0'
    implementation 'cat.ereza:customactivityoncrash:2.4.0'
    implementation 'com.github.bassaer:materialdesigncolors:1.0.0'
    implementation 'com.github.bumptech.glide:glide:4.16.0'
    implementation 'com.github.bumptech.glide:annotations:4.16.0'
    implementation 'com.github.bumptech.glide:okhttp3-integration:4.16.0'
    implementation 'com.github.jahirfiquitiva:TextDrawable:1.0.3'
    //implementation 'com.github.TeamNewPipe:NewPipeExtractor:289db1178ab66694c23893e6a487d4708343c47b'
    implementation 'com.github.teamnewpipe:NewPipeExtractor:v0.22.7'
    implementation('com.github.thegrizzlylabs:sardine-android:0.8') { exclude group: 'com.squareup.okhttp3', module: 'okhttp' }
    implementation 'com.google.android.material:material:1.10.0'
    implementation 'com.google.net.cronet:cronet-okhttp:0.1.0'
    implementation 'com.google.zxing:core:3.3.0'
    implementation 'com.guolindev.permissionx:permissionx:1.7.1'
    implementation 'com.hierynomus:smbj:0.11.5'
    implementation 'org.chromium.net:cronet-embedded:76.3809.111'
    implementation 'org.eclipse.jetty:jetty-client:8.1.21.v20160908'
    implementation 'org.eclipse.jetty:jetty-server:8.1.21.v20160908'
    implementation 'org.eclipse.jetty:jetty-servlet:8.1.21.v20160908'
    implementation 'org.fourthline.cling:cling-core:2.1.1'
    implementation 'org.fourthline.cling:cling-support:2.1.1'
    implementation 'org.greenrobot:eventbus:3.3.1'
    implementation 'org.nanohttpd:nanohttpd:2.3.1'
    implementation('org.simpleframework:simple-xml:2.7.1') { exclude group: 'stax', module: 'stax-api' exclude group: 'xpp3', module: 'xpp3' }
    implementation(ext: 'aar', name: 'dlna-core', group: 'fongmi', version: 'release')
    implementation(ext: 'aar', name: 'go-proxy-video', group: 'fongmi', version: 'release')
    leanbackImplementation(ext: 'aar', name: 'dlna-dmr', group: 'fongmi', version: 'release')
    leanbackImplementation 'androidx.leanback:leanback:1.2.0-alpha04'
    leanbackImplementation 'me.jessyan:autosize:1.2.1'
    mobileImplementation(ext: 'aar', name: 'dlna-dmc', group: 'fongmi', version: 'release')
    //mobileImplementation 'androidx.mediarouter:mediarouter:1.6.0'
    mobileImplementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
    mobileImplementation 'com.google.android.flexbox:flexbox:3.0.0'
    //mobileImplementation 'com.google.android.gms:play-services-cast-framework:21.3.0'
    mobileImplementation('com.journeyapps:zxing-android-embedded:4.3.0') { transitive = false }
    annotationProcessor 'androidx.room:room-compiler:2.6.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.16.0'
}
